import { ref } from "vue"
import router from "../../router"
//导入提示
import { Toast } from "vant"
//导入Http
import { Http } from "../../http/map"
export const useGetRoute = () => {
  //起点
  const orig_text = ref("")
  //终点
  const dest_text = ref("")
  //搜索
  async function onSearch() {
    if (orig_text.value == "") {
      Toast.fail("起点不能为空")
    } else if (dest_text.value == "") {
      Toast.fail("终点不能为空")
    } else {
      Toast.success("查询成功")
      let data = Http.getLnalat(orig_text.value)
      let data1 = Http.getLnalat(dest_text.value)
      console.log(data)
      console.log(data1)
    }
  }
  function onClickLeft() {
    router.back()
  }
  return { onClickLeft, orig_text, dest_text, onSearch }
}
